<page-header model="ctrl.navModel"></page-header>

<div class="page-container page-body">

  <div ng-if="ctrl.notifications.length">
    <div class="page-action-bar">
      <div class="page-action-bar__spacer">
      </div>

      <a href="alerting/notification/new" class="btn btn-primary">
        新通道
      </a>
    </div>

    <table class="filter-table filter-table--hover">
      <thead>
        <th style="min-width: 200px">
          <strong>名称</strong>
        </th>
        <th style="min-width: 100px">类型</th>
        <th style="width: 1%"></th>
      </thead>
      <tbody>
        <tr ng-repeat="notification in ctrl.notifications">
          <td class="link-td">
            <a href="alerting/notification/{{notification.id}}/edit">
              {{notification.name}}
            </a>
          </td>
          <td class="link-td">
            <a href="alerting/notification/{{notification.id}}/edit">
              {{notification.type}}
            </a>
          </td>
          <td class="text-right">
            <span class="btn btn-secondary btn-small" ng-show="notification.isDefault == true">
              默认
            </span>
            <a ng-click="ctrl.deleteNotification(notification.id)" class="btn btn-danger btn-small">
              <i class="fa fa-remove"></i>
            </a>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
  <div ng-if="ctrl.notifications.length === 0">
    <empty-list-cta
    title= "'还没有定义告警消息通道'"
    buttonIcon= "'gicon gicon-alert-notification-channel'"
    buttonLink= "'alerting/notification/new'"
    buttonTitle= "'增加通道'"
    proTip= "'您可以在告警通知中包含图像.'"
    proTipLink= "'http://docs.grafana.org/alerting/notifications/'"
    proTipLinkTitle= "'了解更多'"
    proTipTarget= "'_blank'"
    />
  </div>
</div>

<footer />
